TITL DAI FIRMWARE 2E1FD-2E315 V1.0 Rev.1 ORG :E1FD * * * ************************************ * INITIALISE SCREEN CHARACTER AREA * ************************************ * * Fills screen with spaces (clears screen). * The line mode byte is set #7A, the line colour * byte to #40, all colour bytes to #00 (4-colour * text), all character bytes to #20. * * Entry: HL: 1st byte after header. * DE: end character area. * Exit: All registers preserved. * FILLS PUSH PSW PUSH B PUSH D PUSH H FIS10 MVI M,:7A Set control byte for char REM mode DCX H MVI M,:40 Set line colour byte DCX H FIS20 MVI B,:42 Number of bytes/line FIS30 MVI M,:20 Data byte is space DCX H MVI M,:00 Colour byte is 00 DCX H DCR B JNZ :E209 Next screen addr CALL :E6FB All lines done ? JNZ :E201 Next line if not JMP :E138 Popall, ret * **************************** * CHANGE TO CHARACTER MODE * **************************** * * If a character is output when the screen is in * all-graphic mode, the mode is changed to the * corresponding split-mode. * If not sufficient space available, mode 0 is * tried. If still insufficient space, the emergency * stop routine is used. * TMODE PUSH PSW LDA :009D Get current screen mode RRC Already character mode ? JC :E231 Abort if true STC CY=1 RAL Set for split mode CALL :E3D9 Change mode MVI A,:FF CC :E3D9 Change to mode 0 if not REM sufficient space JC :E233 Emergency stop if still REM insufficient space TMD10 POP PSW RET REM * If no space for A-mode or mode 0: REM TMD20 LHLD :00C6 Get addr emergency stop REM routine PCHL Go to this routine * ******************** * SET TEXT COLOURS * ******************** * * The COLORT parameters are set: the header * and trailer of the character area are * initialised. * The colour values are between 0 and F. The * top 4 bits are ignored. * The colour change is immediate. * * The 1st 2 colours are the default background * and foreground colours for characters. The last * 2 are alternative, and may be used for (e.g.) * the cursor. Colours may be repeated. * * Entry: HL points to a vector of 4 bytes containing * the colours to be set. * Exit: All registers preserved. * SCOLT PUSH PSW PUSH B PUSH D PUSH H LXI D,:007C Addr 1st byte colour REM register memory CALL :E254 Init. COLORT reg memory LDA :009D Get current screen mode RAR Char mode? LHLD :008A Get startaddr char area CC :E267 If char mode: set colours REM header area LHLD :008E Get addr end of screen CC :E267 If char mode: set colours REM trailer area JMP :E138 Popall, ret * ************************* * SET COLOUR PARAMETERS * ************************* * * Loads colour data from ROM into the RAM pointers. * The high nibbles are 8x, 9x, Ax, Bx. * Used for both COLORT and COLORG. * * Entry: HL: Points to colour parameters. * DE: Address colour memory in RAM. * Exit: DE: Points after colour memory. * Other registers corrupted. * VCOPY LXI B,:1080 VCP10 MOV A,M Get colour from ROM ANI :0F ORA C Add bits 4-7 STAX D Store in RAM INX H Next colour INX D Next RAM location MOV A,C ) ADD B ) Add #10 to C MOV C,A ) CPI :C0 Check if finished JNZ :E257 Next one if not RET * *************************************** * LOAD COLOURS IN HEADER/TRAILER AREA * *************************************** * * Sets blanking area colour bytes according to * information given. * The colourbytes for the character area are * loaded into the screen header and trailer area. * * Entry: HL: Points to 1st control byte after * blanking area. * DE: Points after table with colours * in RAM. * Exit: AFDE preserved, BCHL corrupted. * BCOLS PUSH PSW PUSH D LXI B,:0004 Distance between colour byte DCX H Addr 1st colour byte of REM screen RAM BCS10 DCX D Addr colour table LDAX D Get colour byte DAD B HL = addr in screen RAM MOV M,A Load byte into screen RAM ANI :30 Finished ? JNZ :E26D Next colourbyte if not POP D POP PSW RET * *********************** * SET CURSOR POSITION * *********************** * * Moves the cursor from its current position to * any requested position. * Position 0,0 is the bottom left corner. * * Entry: HL contains the y,x position required * for the cursor. * Exit: BCDEHL preserved. * CY=0: OK. F corrupted, A preserved. * CY=1: Request off screen. * A=01 (error code 'off screen'). * SCURS ORA A PUSH H PUSH D PUSH B PUSH PSW MOV A,L X-coord in A CPI :3C After end of line ? JNC :E2C5 Then request off screen ADD A X-coord *2 MOV C,A in C MVI B,:18 Nr of lines in mode 0 LDA :009D Get current screen mode ORA A JM :E295 Jump if mode 0 MVI B,:04 Nr of lines in A-modes RAR JNC :E2C5 Error if all-graphics mode SCS10 MOV A,H Y-coord in A CMP B More than max value JNC :E2C5 Then request off screen CALL :E36B Delete old cursor INR A LXI H,:0086 Length 1 char line CALL :EB46 Calc length reqd number of REM lines (HL=A*HL) XCHG in DE LHLD :008C Store end archive area DAD D Start of reqd line CALL :E698 Store addr line mode byte REM current line and store last REM byte on that line LXI D,:0008 CALL :E6F2 HL=start of right border MOV E,C MVI D,:00 CALL :E6F2 Subtract char offset CALL :E330 Put cursor on screen MVI A,:00 STA :007B No extended lines POP PSW No-error return SCS20 POP B POP D POP H RET REM * If error 'off screen': REM SCS30 POP PSW MVI A,:01 Set error code CMC Change CY to 1 JMP :E2C1 Pop, ret * ************************************************* * ASK CURSOR POSITION AND SIZE CHARACTER SCREEN * ************************************************* * * Returns the position of the cursor and the * range of possible values. * Values given in DE are maximum values of * coordinates. * If the mode is all graphics: DE=HL=0. * * Entry: None. * Exit: HL gives y,x cursor position. * DE gives y,x size of character part of * the screen (mode 0: #17,#3B: A-modes: * #03,#3B). * AFBC preserved. * SCURA PUSH PSW PUSH B LXI H,:0000 MOV D,H MOV E,L DE=HL=0 LDA :009D Get current screen mode RAR Char mode ? JNC :E313 Abort if not LHLD :0078 Get startaddr cursor line PUSH H Save it on stack LXI D,:FFF8 Size left border DAD D Get addr 1st char byte XCHG in DE LHLD :0072 Get cursor pos addr XCHG CALL :E6F2 Calc difference of cursor REM pos from begin of line POP D Get startaddr current line MOV A,L (x-coord cursor)*2 in A ORA A RAR Now x-coord cursor in A PUSH PSW Save it on stack LHLD :008C Get addr end char area LXI B,:0086 Length 1 char line XRA A Init Y-pos SCA10 PUSH PSW Save it on stack DAD B Get line mode byte next line CALL :E6FB Is current line this line? JZ :E303 Then jump POP PSW Get Y-coord INR A Incr it JMP :E2F6 Check if on next line SCA20 POP H Y-coord cursor in H POP PSW X-coord cursor in A MOV L,A and now in L MVI D,:17 Nr of lines for mode 0 -1 LDA :009D Get current screen mode ORA A JM :E311 Jump if mode 0 MVI D,:03 Nr of lines for A-modes -1 SCA30 MVI E,:3B Nr of char/line -1 SCA40 POP B POP PSW RET * * * END